
var arr;

function rain(canvas) {
    var str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".split("");
    var ctx = canvas.getContext("2d");
    ctx.fillStyle = "rgba(0,0,0,0.05)";
    ctx.fillRect(0, 0, canvas.width, canvas.height);
    ctx.fillStyle = "#0f0";
    arr.forEach(function (value, index) {
        ctx.fillText(str[Math.floor(Math.random() * str.length)], index * 10, value + 10);
        arr[index] = value >= canvas.height || value > 8888 * Math.random() ? 0 : value + 10;
    });
}
